home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Internet Tools (InfoMagic)
/
Internet Tools.iso
/
dos_win
/
winsock
/
maillist
/
94-05.Z
/
94-05
/
000089_fit106@its.csiro.au_Fri May 6 20:23:09 1994.msg
< prev
next >
Wrap
Internet Message Format
|
1994-05-31
|
3KB
Received: from commsun.its.csiro.au by SunSITE.Unc.EDU (5.65c+IDA/FvK-1.07) with SMTP
id AB20557; Thu, 5 May 1994 20:24:39 -0400
Received: by commsun.its.CSIRO.AU id AA07843
(5.65c/IDA-1.4.4 for Multiple recipients of list <winsock@sunsite.unc.edu>); Fri, 6 May 1994 10:23:11 +1000
Date: Fri, 6 May 1994 10:23:09 +1000 (EST)
From: Kent Fitch <Kent.Fitch@its.csiro.au>
Sender: Kent Fitch <Kent.Fitch@its.csiro.au>
Reply-To: Kent Fitch <Kent.Fitch@its.csiro.au>
Subject: Re: New Telnet/MUDClient Troubles
To: Chris Rowley <chris@clubside.digex.net>
Cc: Multiple recipients of list <winsock@sunsite.unc.edu>
In-Reply-To: <chris.4.000DFC32@clubside.digex.net>
Message-Id: <Pine.3.89.9405061049.A7127-0100000@commsun.its.CSIRO.AU>
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
On Thu, 5 May 1994, Chris Rowley wrote:
> > I am no expert by any means but is it possible to write everything in
> >Visual Basic? <:-) (maybe a dumb question) Can the interface to winsock (VBX)
> >be written in VB itself?
>
> Hi Paul,
> As visual basic stands, it looks like the answer in no. The hostent data
> structure (which is used for such, oh, noteworthy functions like
> gethostbyname, cannot be realized in VB because it contains lists of lists.
At the risk of sounding like a zealot, I think that ALMOST ANYTHING to do
with WINSOCK can be written in VB. I have done a basic set of routines
in VB calling the WINSOCL DLL directly - these worked in blocking mode,
and I am currently porting them to work in async mode - this would be
impossible except for the wonderful MSGBLAST.VBX (public domain from
Microsoft). Meanwhile, to call the blocking "get host by name", use
something like this fragment:
Type hostent
h_name_addr As Long
h_aliases_ptr_addr As Long
h_addrtype As Integer
h_length As Integer
h_addr_list_ptr_addr As Long
End Type
Declare Function gethostbyname Lib "winsock.dll" (ByVal hostname As
String) As Long
Declare Sub hmemcpy Lib "Kernel" (dest As Any, src As Any, ByVal n As Long)
Function TCPHostLookup (host$) As Long
Dim thishost As hostent
Dim hostptr As Long
Dim addrp As Long
Dim addr1 As Long
TCPHostLookup = 0 ' assume the werst
hostptr = gethostbyname(ByVal host$)
If hostptr = 0 Then
Debug.Print "lookerr:" & TCPGetErrorMsg()
Else
Debug.Print "hostptr="; hostptr
hmemcpy thishost, ByVal hostptr, 16
hmemcpy addrp, ByVal thishost.h_addr_list_ptr_addr, 4
Debug.Print "addrp=", addrp
If addrp <> 0 Then
hmemcpy addr1, ByVal addrp, 4
Debug.Print "final addr=", addr1
TCPHostLookup = addr1 ' the jackpot
End If
End If
End Function
Note: TCPGetErrorMsg() just gets the last WS error and decodes into English
Goodluck
Kent Fitch Ph: +61 6 276 6711
ITSB CSIRO Canberra Australia kent.fitch@its.csiro.au
"We dare not trust our wit for making our house pleasant for our friends,
so we buy ice-cream" - Ralph Waldo Emerson